`
https://leetcode.cn/problems/largest-perimeter-triangle/
`

/**
 * @param {number[]} nums
 * @return {number}
 */
var largestPerimeter = function (nums) {
  // 排序 + 贪心
  nums.sort((a, b) => a - b)
  for (let i = nums.length - 1; i >= 2; i--) {
    if (nums[i] < nums[i - 1] + nums[i - 2]) {
      return nums[i] + nums[i - 1] + nums[i - 2]
    }
  }
  return 0
};